#include <iostream>
#include "Course.h"           //外部文件的引入
#include "CourseInHouse.h"
#include "CourseOutHouse.h"
#include <QDebug>

int main(int argc, char *argv[])
{
    Course*cinhouse = new CourseInHouse();  // 不能new course，因为course里有虚函数，是抽象的！
    Course*couthouse = new CourseOutHouse(); // 也就是不能实例化抽象类！
    // new 两个对象（这里用指针定义），有两门课（前面的头文件里已经用QString定义）
    // 而前面的大类course没有后面添加的属性，这是由类生成对象的过程
    // 对象就是实例化过程，后面的事情由实例化的对象去做，这是C++的精髓所在

    CourseInHouse* cinhouse2 = static_cast<CourseInHouse*>(cinhouse);
    // CourseOutHouse* couthouse2 = static_cast<CourseOutHouse*>(couthouse);

    cinhouse->setName ("Math");
    cinhouse->setCode ("C01");         // 每门课有多种特性（多种值）
    cinhouse2->setBuilding("E01");
    cinhouse2->setUsingProjector(true);

    couthouse->setName ("basketball");
    couthouse->setCode ("C02");
    //couthouse->setNeedTeacher(true);
    //couthouse->setUsingPlayground(false);
    //couthouse->setIfDependsOnWeather(false);

    qDebug() << cinhouse->name()     //
             << cinhouse->code()    //调试性的将这些值打印出来
             << cinhouse2->Building()
             << cinhouse2->usingProjector();
    cinhouse->registerCourse();

    qDebug() << couthouse->name()
             << couthouse->code();
    couthouse->registerCourse();
             //<< couthouse->needTeacher()
             //<< couthouse->usingPlayground()
             //<< couthouse->ifDependsOnWeather();

    delete cinhouse;
    delete couthouse;                 //定义指针后立马在这里进行释放！
    return 0;
}
